UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's2YupZLbbY72a7AwILHG6Ia67K7ncxZTYAQxnLkWrwk=' 
WHERE 
  key_id = '37765b02d9d8e946323be479679666332a2f2a5f0a42d4c19c4ffcbed5807cf9' 
  AND (
    token = 's2YupZLbbY72a7AwILHG6Ia67K7ncxZTYAQxnLkWrwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041