UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xAYv+leYBJub5PU53+GjSqvwuZ7FrYD3yFvMGcohrnU='
WHERE
key_id = '99c9ebeeb8859ce64f6b34a4a4821ca1943fb528d73ddd3d2c6355710e1b177f'
AND (
token = 'xAYv+leYBJub5PU53+GjSqvwuZ7FrYD3yFvMGcohrnU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)