UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SNwn5UYDFOWd8Ney8LpN2GzoYVMZ0pb9A1XTarhkzmo='
WHERE
key_id = '087a2df6a491ce235c5ad383bf01635cfa11ac5023c97282c969c59cd1b8ca46'
AND (
token = 'SNwn5UYDFOWd8Ney8LpN2GzoYVMZ0pb9A1XTarhkzmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)