UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E7SrMqOQh636kYSiV3ahY2sva0Tso2GQmd3Z9zXcbcE='
WHERE
key_id = '7217d0544ccd2f433915b42a45841ad5d7a24c71c52f7db3b7e30cba8338b392'
AND (
token = 'E7SrMqOQh636kYSiV3ahY2sva0Tso2GQmd3Z9zXcbcE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)