UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G7kEbjJz32MDNarsn8JVpBKKqE9qNKJmg8Uc5Q94070='
WHERE
key_id = '27a5763f0a084f29ff2a9d3282f63955b0bbe8706d84823c1408f4dcc65177c4'
AND (
token = 'G7kEbjJz32MDNarsn8JVpBKKqE9qNKJmg8Uc5Q94070='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)