UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pmwx9a7zkuRF19Af+dDe1/pu2ayRqb27lCTyVGAOEX4='
WHERE
key_id = 'ec5428106d682f196bb4759936a4bd4f2c5a257929f447e813cf5490d87aab50'
AND (
token = 'pmwx9a7zkuRF19Af+dDe1/pu2ayRqb27lCTyVGAOEX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)