UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8NpkIiK6UGJeazJpMvMuyPkyrQDx0YVFIPwThFfBmQ8='
WHERE
key_id = '79f608fbf9ab5492ee44dae7fc6a1bd383d0b51d58657a1838556123e7670a81'
AND (
token = '8NpkIiK6UGJeazJpMvMuyPkyrQDx0YVFIPwThFfBmQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)