UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ebFwX1jKklnHeQOJTI0f89FhK1e/8n2kZxqLorWDxFk='
WHERE
key_id = 'd69dafcec6389a6e7cac21d9ec4eaf813da4509324320051b4d18f16697cbc31'
AND (
token = 'ebFwX1jKklnHeQOJTI0f89FhK1e/8n2kZxqLorWDxFk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)