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