UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3jCpMIrHsJYcp867KBVT/oN5zW+x1fh29WSaLEuVf5Y=' 
WHERE 
  key_id = '402cf656885d2d8ab5e1590dd4ecfbdfe0a007db90ca1f30844a57b9fe4aab38' 
  AND (
    token = '3jCpMIrHsJYcp867KBVT/oN5zW+x1fh29WSaLEuVf5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044