UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K+JhqhXTsfRyY3vdNQPexIbYCZdoq3UUg9wAsS5WKlo='
WHERE
key_id = '3f4557fdf8c5d510b27697c4668829b943f69af1fbb006578016a722812236d4'
AND (
token = 'K+JhqhXTsfRyY3vdNQPexIbYCZdoq3UUg9wAsS5WKlo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)