UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiPjrlJ/3X4K940xentgwJ/b81SKSMulBt3rdgJdEok=' 
WHERE 
  key_id = 'bb3de6496376a5767e031f676fc197b8b16f1255b7832328a3482d89d35cbb77' 
  AND (
    token = 'uiPjrlJ/3X4K940xentgwJ/b81SKSMulBt3rdgJdEok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016