UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4IR0kT8PMuWLugbejPitVopY0DZTi1RSuMianS7MAvk=' 
WHERE 
  key_id = '49551468b7357060f033d8426da19e3dae1cee87c9974bdc06d28708908f348b' 
  AND (
    token = '4IR0kT8PMuWLugbejPitVopY0DZTi1RSuMianS7MAvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026