UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lfZfFhOY5ELCWvQ9+WoVeDFCLye/sQJUg7v50rAyk7g='
WHERE
key_id = 'be99d671e2e63a9786527392d2e3052765ace7f6a3242673bb60a0025b140dd5'
AND (
token = 'lfZfFhOY5ELCWvQ9+WoVeDFCLye/sQJUg7v50rAyk7g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)