UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3R9733rCBXQdwtI4YdT23NEPbE0izIp8R4twChqajpY='
WHERE
key_id = '0af777e1f886a239bd60c42f42ea26a28fa78048d322836d44b9c1fc11d668c0'
AND (
token = '3R9733rCBXQdwtI4YdT23NEPbE0izIp8R4twChqajpY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)