UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JbX2E2Gxe2Fn+MxiyAngp2EAyHZjTnkvaTaQ0lSEGhw=' 
WHERE 
  key_id = 'dd5087bd5d0d696d62e3011e65eeb3f99e710cb19edc09cb1fda11107036d998' 
  AND (
    token = 'JbX2E2Gxe2Fn+MxiyAngp2EAyHZjTnkvaTaQ0lSEGhw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00090