UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OjdM1fnV89D0VbSHvvvdGXTdkDcPPv/n2baWsZZE1qI='
WHERE
key_id = 'e03ee59ffbf8d5e6a2e486343d53c3131ee7abb2a2570ec294ef93c14187ee2c'
AND (
token = 'OjdM1fnV89D0VbSHvvvdGXTdkDcPPv/n2baWsZZE1qI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)