UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hde7iM4feyEoUwOnQ5CfKqCDd7ri3AL7BIZZHADw0Rs='
WHERE
key_id = '2a8bb776643349c8cc799a5060e86d056ef20ad3c04c7f1771ea9e263a616391'
AND (
token = 'hde7iM4feyEoUwOnQ5CfKqCDd7ri3AL7BIZZHADw0Rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)