UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1xqXmUA7F4Ynzwgjjr12bgjpo6sBRwJm9jedaA8XuJc='
WHERE
key_id = 'e31660c414a73e6a23f176fa667758568ffb74a7c2ff10815ef865997c59207f'
AND (
token = '1xqXmUA7F4Ynzwgjjr12bgjpo6sBRwJm9jedaA8XuJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)