UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'byCK/L0gHttBQt4TaHxw0ffMA29RCvUPJX+D5OrmGp8='
WHERE
key_id = 'ac2036ab3e8053976a24eafd80f7bf69aca264865ed031b3c17b3a8a696a6f2f'
AND (
token = 'byCK/L0gHttBQt4TaHxw0ffMA29RCvUPJX+D5OrmGp8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)