UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3aDeUlttgL3q4nPunWCwBYRcqAfyfnJXCKOrS903htE=' 
WHERE 
  key_id = 'aa29ad320769108f06760c878c1e18d01f851edd10695394f7ab409746fa6e83' 
  AND (
    token = '3aDeUlttgL3q4nPunWCwBYRcqAfyfnJXCKOrS903htE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032