UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fp+hLB6//qusC8O/El7YYAkCIEgBo70pqGswIf4oQrw=' 
WHERE 
  key_id = '87e1d80af29946e24961b19c075e3750273391492b810950526bf60636b8b666' 
  AND (
    token = 'Fp+hLB6//qusC8O/El7YYAkCIEgBo70pqGswIf4oQrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019