UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tdyf7QS7OI+1m3Fp2TUai2oy/3ET5AbP7VtorUt78tU=' 
WHERE 
  key_id = '6a0c504f3d76dd946600d6875221b2bcee7f803221fc572e9dbbebda8a2bade2' 
  AND (
    token = 'Tdyf7QS7OI+1m3Fp2TUai2oy/3ET5AbP7VtorUt78tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017