UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XyF4M082aUPTpQWuLVrnmt6qKOzm2RMXDDZ+RlxjdZk='
WHERE
key_id = 'd4a450edbb3309d833db366dec2f584fc95769eea5edc8e12d5f7b86ca826141'
AND (
token = 'XyF4M082aUPTpQWuLVrnmt6qKOzm2RMXDDZ+RlxjdZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)