UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JUGMZNqnemPy7emnTH8xylMJ0blJ1kvD5fxKQ9KmIrc='
WHERE
key_id = '40657ae277c01589493fd7ef0d3e981706148be69a675d9385f762369b7ba4e1'
AND (
token = 'JUGMZNqnemPy7emnTH8xylMJ0blJ1kvD5fxKQ9KmIrc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)