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