UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JzyqOrhfMitgEYtVJHbnahtQCnz0AsRT5/qzcYrNhuQ=' 
WHERE 
  key_id = '218bda232c2904e815b3a14833aacddb3a7888325dbb8d48abb5909ceb021396' 
  AND (
    token = 'JzyqOrhfMitgEYtVJHbnahtQCnz0AsRT5/qzcYrNhuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032