UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ey8Z6ypUOm24oklHgNGBp9xxW1ZDzDpcneXYQw5e9UY='
WHERE
key_id = '58b8e56dd83e09a2c4ac610a22faef6261f03d1d9b8e861913b9dd660894b1b4'
AND (
token = 'ey8Z6ypUOm24oklHgNGBp9xxW1ZDzDpcneXYQw5e9UY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)