UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bUoxN7+oWU8J7sELQeOAuOVGISUowXPLFvORky2hiJE='
WHERE
key_id = '69d4d6465497234eab5b4bb4df960ee39a3ce60590c87304a2ac11f28e69cbab'
AND (
token = 'bUoxN7+oWU8J7sELQeOAuOVGISUowXPLFvORky2hiJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)