UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'chzeq10Nifmn0RG3f4IaReAMkVh7OHVNm0w0Q2Te5gM='
WHERE
key_id = 'e31daed46851a6ac6497c20bf63e9d8c69148cfb0a1e744d350c99f72ebef571'
AND (
token = 'chzeq10Nifmn0RG3f4IaReAMkVh7OHVNm0w0Q2Te5gM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)