UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQBlF890gAR8O35Bfdx5rHrJ6NaOaz/ahASKUfLMouE='
WHERE
key_id = 'd82116ad20989a0c3d08258fd834482f75fa0f6a39995df317d72d60d95fc9bd'
AND (
token = 'hQBlF890gAR8O35Bfdx5rHrJ6NaOaz/ahASKUfLMouE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)