UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k5NBzjuLuvH0saCMQ44eCMFO/WIDGFLqIxzg57Q70ZU='
WHERE
key_id = '9f9377897bf201cf4cf634278b401f3889cca0d8066e3fda56d5b23b14515a8a'
AND (
token = 'k5NBzjuLuvH0saCMQ44eCMFO/WIDGFLqIxzg57Q70ZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)