UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v2btOyM8+4yV5txwO04Ignii67P8paGjad/4USG+1gU='
WHERE
key_id = '8305347173631a3aae4962d0964189cd9e61e82adf2057bde111573ae7ebfbe5'
AND (
token = 'v2btOyM8+4yV5txwO04Ignii67P8paGjad/4USG+1gU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)