UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c52f4OgTtKG7jX2HgDLI8kAfbPWv/18aJ+mhkrDFzRg='
WHERE
key_id = '8c0253a4b09fa7c2f65c27fe32b25d7e9405e62775abc59285a46e091d694a3c'
AND (
token = 'c52f4OgTtKG7jX2HgDLI8kAfbPWv/18aJ+mhkrDFzRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)