UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6W9KeIa3BxvISGjC+PIPZa9S3MhIYRBq/ys1qhUaIyc='
WHERE
key_id = 'e3795fe582bd1aeecf6326e9812f822370ff21c48a3aa9f9e7ac2f5567e51e97'
AND (
token = '6W9KeIa3BxvISGjC+PIPZa9S3MhIYRBq/ys1qhUaIyc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)