UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hRAz52z8hrRaWCiXlhpXbsqvC/BoneHzWCMPyfYrBMQ='
WHERE
key_id = 'ea04a0d779a3738c1f0611537433923a974cf9843c7c7f90792143a9cdfb75ef'
AND (
token = 'hRAz52z8hrRaWCiXlhpXbsqvC/BoneHzWCMPyfYrBMQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)