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