UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0N5LGudI8zdVr6A6xcAiQcGLLBJB4ZdA+zqFJjR1h8g='
WHERE
key_id = 'e2425b64500c36cacd4767a9fc09e18da3f12688581eee5ef717a8b4ff68136a'
AND (
token = '0N5LGudI8zdVr6A6xcAiQcGLLBJB4ZdA+zqFJjR1h8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)