UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R0L3N2fr4uWCcZYW9Soa5jWozt4poNF5QKZhakQNQaQ='
WHERE
key_id = '1271eceb16b8b219d27f5d43d0902c33646bf369d3229849b69f69044df8d4de'
AND (
token = 'R0L3N2fr4uWCcZYW9Soa5jWozt4poNF5QKZhakQNQaQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)