UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r3KvTXpwOZlhAuOdJeOMd5aT7RGIg5W69K9Ht75kG2c='
WHERE
key_id = '40f8bf52e602b36fdeb5b92be95f03ef349f8570f93578a5b9dee0ff571c9446'
AND (
token = 'r3KvTXpwOZlhAuOdJeOMd5aT7RGIg5W69K9Ht75kG2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)