UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YhErfC0cKlWBe0z2infXKSlgCf0tTH14YItVs9H60ks='
WHERE
key_id = '4d38ef6fecad295ed3aaba10ee257fe483e79acc973da58ad60b7c0b630c8a03'
AND (
token = 'YhErfC0cKlWBe0z2infXKSlgCf0tTH14YItVs9H60ks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)