UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I0YiUJuGGGs030oYKOouR1RKAEQN8TDeL3ophCe0+eg='
WHERE
key_id = '00cdb46f3b7483e56f57e10e5946b31662721ca54d29d9e5b8ad4a37286b1c33'
AND (
token = 'I0YiUJuGGGs030oYKOouR1RKAEQN8TDeL3ophCe0+eg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)