UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VKfjaSZg0LmBNS7j5ygdhaQkd6GnDmo5IJVB3+N/BTA='
WHERE
key_id = 'd52849841dfafab0f7ef51b521103a540d33b2feeb839487374976bb0a874593'
AND (
token = 'VKfjaSZg0LmBNS7j5ygdhaQkd6GnDmo5IJVB3+N/BTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)