UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZCNbMt2kmEdLcr8JwZibG8LLH3wsFw3XOMF6VJkkfQ8='
WHERE
key_id = '043ac5f3e565174ff5fbeb0c1b9acd60b696e07232b0eb84243904305ba945dc'
AND (
token = 'ZCNbMt2kmEdLcr8JwZibG8LLH3wsFw3XOMF6VJkkfQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)