UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'an9YPJ58PoaYcNqQLncVIqW0eKYScqMrZRCTZUaBz9M='
WHERE
key_id = '179773de16569b403ddfc9f182637f05a3647e6fe17c0bff4bf73fc2b8552cab'
AND (
token = 'an9YPJ58PoaYcNqQLncVIqW0eKYScqMrZRCTZUaBz9M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)