UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F5C14UpHDeuvSnOLYGVt3sBkuaynyYWS0YcBw8aK1gQ=' 
WHERE 
  key_id = '38cd1bdda6345372ef1d85fdf521927bb5633d589e4530162788130203c14935' 
  AND (
    token = 'F5C14UpHDeuvSnOLYGVt3sBkuaynyYWS0YcBw8aK1gQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036