UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cVWY39KzX3Fkxf1V3hhNsTc52F4A9Z85+GiGPyyae/E='
WHERE
key_id = 'd3f2d2b2d8b02934fd6fb11f7098f7173d63b06d57bb65c7c24418ee84f806dc'
AND (
token = 'cVWY39KzX3Fkxf1V3hhNsTc52F4A9Z85+GiGPyyae/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)