UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NI2xlFJiq4k+zq4e/I9wy/gqy0m3ag6yJflAgA3fo1U='
WHERE
key_id = '944419b05b9f327bce9d5733cc3a53586e9f4faf7ae90727999cdeb582ded90f'
AND (
token = 'NI2xlFJiq4k+zq4e/I9wy/gqy0m3ag6yJflAgA3fo1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)