UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CwXXJJpSAtRSvj3s99/3LNRdMqFmUmHtS3s+qpah/Tg='
WHERE
key_id = '1b0723f3612e09a495155150fc6596b4537ff544b11e51d4c65de372c44f0352'
AND (
token = 'CwXXJJpSAtRSvj3s99/3LNRdMqFmUmHtS3s+qpah/Tg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)